<template>
    <view class="container">
        <view class="pay-price-box margin padding">
            <view style="color: #cccccc; font-size: 28rpx">实付金额</view>
            <view class="price">
                <text class="unit">¥</text>
                <text>{{ $root.f0 }}</text>
            </view>
        </view>
        <view class="list margin">
            <view
                @tap="__e"
                class="list-item padding-h"
                :data-event-opts="[['tap', [['payTypeChange', ['$event']]]]]"
                data-type="wechat_pay"
                v-if="info.method && info.method.wechat_pay.is_enable"
            >
                <view class="body">
                    <image class="type-logo" src="https://img121.7dun.com/yuanqimali/payCenter/WXIcon.png"></image>
                    <text>微信支付</text>
                </view>
                <view class="body">
                    <image class="type-logo" src="/static/static/wechat.png"></image>
                </view>
                <radio :checked="current == 'wechat_pay'" color="#9DF9FC"></radio>
            </view>
            <view
                @tap="__e"
                class="list-item padding-h"
                :data-event-opts="[['tap', [['payTypeChange', ['$event']]]]]"
                data-type="alipay"
                v-if="info.method && info.method.alipay.is_enable"
            >
                <view class="body">
                    <image class="type-logo" src="/static/static/ali-pay.png"></image>
                    <text>支付宝支付</text>
                </view>
                <radio :checked="current == 'alipay'" color="#9DF9FC"></radio>
            </view>
        </view>
        <view class="footer safe-area-bottom">
            <button @tap="__e" :class="[current === 'balance' ? 'bg-grays' : 'bg-oranges']" :data-event-opts="[['tap', [['handleClick', ['$event']]]]]" :long="true" size="large">
                <text>{{ current === 'balance' ? '余额不足' : '' }}</text>
            </button>
        </view>
    </view>
</template>

<script>
import iButton from '@/components/Button/index';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['pages/payCenter/index'],
    {
        1275: function (t, e, n) {
            'use strict';

            var i = n('8e4e');
            n.n(i).a;
        },
        '2cf1': function (t, e, n) {
            'use strict';

            (function (t) {
                var i = n('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var u = i(n('452d'));
                var o = i(n('82c0'));
                var r = {
                    mixins: [u.default],
                    components: {
                        IButton: function () {
                            n.e('components/Button/index')
                                .then(
                                    function () {
                                        return resolve(n('93c4'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        }
                    },
                    data: function () {
                        return {
                            from: '',
                            uuid: '',
                            current: 'wechat_pay',
                            info: {},
                            grouponRecord: {
                                uuid: ''
                            }
                        };
                    },
                    computed: {
                        userInfo: function () {
                            return this.$store.getters.userInfo;
                        }
                    },
                    onLoad: function (e) {
                        var that = this;
                        this.from = e.from;
                        this.grouponRecord.uuid = e.groupon_record_uuid;
                        t.showLoading({
                            title: '加载中',
                            mask: true
                        });
                        this.uuid = e.uuid;
                        this.$api.emit('order.payment_detail', e.uuid).then(function (e) {
                            that.info = e.data;
                            t.hideLoading();
                        });
                    },
                    methods: {
                        payTypeChange: function (t) {
                            this.current = t.currentTarget.dataset.type;
                        },
                        handleClick: function (e) {
                            var that = this;
                            if ('balance' !== this.current) {
                                t.showLoading({
                                    title: '加载中',
                                    mask: true
                                });
                                this.$api
                                    .emit('order.pay_config', this.uuid, {
                                        pay_type: 'wechat',
                                        sub_type: 'miniapp'
                                    })
                                    .then(function (e) {
                                        t.hideLoading();
                                        o.default.pay({
                                            pay_config: e.data.pay_config,
                                            pay_type: e.data.pay_type,
                                            success: function () {
                                                if ('groupon' === that.from) {
                                                    t.redirectTo({
                                                        url: '/pages/groupon/recordDetail/index?uuid=' + that.grouponRecord.uuid
                                                    });
                                                } else {
                                                    t.redirectTo({
                                                        url: '/pages/orderList/index?current=1'
                                                    });
                                                }
                                            },
                                            faild: function () {}
                                        });
                                    });
                            }
                        }
                    }
                };
                e.default = r;
            }.call(this, n('543d').default));
        },
        '51e4': function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return i;
            });
            n.d(e, 'c', function () {
                return u;
            });
            n.d(e, 'a', function () {});
            var i = function () {
                this.$createElement;
                var t = (this._self._c, this._f('priceToFixed')(this.info.money));
                this.setData(
                    Object.assign(
                        {},
                        {
                            $root: {
                                f0: t
                            }
                        }
                    )
                );
            };
            var u = [];
        },
        '58eb': function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('2cf1');
            var u = n.n(i);
            for (var o in i) {
                if (['default'].indexOf(o) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return i[t];
                        });
                    })(o);
                }
            }
            e.default = u.a;
        },
        '8e4e': function (t, e, n) {},
        c897: function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('51e4');
            var u = n('58eb');
            for (var o in u) {
                if (['default'].indexOf(o) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return u[t];
                        });
                    })(o);
                }
            }
            n('1275');
            var r = n('f0c5');
            var a = Object(r.a)(u.default, i.b, i.c, false, null, null, null, false, i.a, void 0);
            e.default = a.exports;
        },
        d6b6: function (t, e, n) {
            'use strict';

            (function (t, e) {
                var i = n('4ea4');
                n('18ba');
                i(n('66fd'));
                var u = i(n('c897'));
                t.__webpack_require_UNI_MP_PLUGIN__ = n;
                e(u.default);
            }.call(this, n('bc2e').default, n('543d').createPage));
        }
    },
    [['d6b6', 'common/runtime', 'common/vendor']]
]);
</script>
<style>
@import './index.css';
</style>
